<?php
namespace Home\Controller;
use Home\Controller\BaseController;
class IndexController extends BaseController {
	public function _initialize(){
	}
    public function index(){		
	   $this->assign("news",$this->listMessage("news"));
	   $this->assign("groups",$this->listMessage("groups","yjl_check","1"));
	   $this->assign("practices",$this->listMessage("practices","yjl_check","1"));
	   $this->display();
    }
	
	public function register(){
		parent::add("users","yjl_photo");
	}
	
	public function listMessage($tbl,$field,$value){
		$model=M($tbl);
		if($field){
			$lists = $model->where("$field=$value")->order("yjl_id desc")->limit("0".','."5")->select();
		}else{
			$lists = $model->order("yjl_id desc")->limit("0".','."5")->select();
		}
		return $lists;
		
	}
}